<template>
	<view>
		
		<u-toast ref="uToast" />
		<u-divider color="#62C26C">话题标题</u-divider>
		<u-input v-model="postMsg.title" placeholder=" 请输入..."/>
		<u-divider color="#62C26C">话题内容</u-divider>
		<textarea v-model="postMsg.body" class="u-p-20" placeholder="分享新鲜事..." /><u-toast ref="uToast" class="tanchuang"/>
		<upLoadF @ping='gettopShow'></upLoadF>
		<button type="primary" @click="postC">确认发布</button>	
		
	</view>
</template>

<script>
	import upLoadF from '@/components/uploadFile/uploadFile.vue'
	export default {
		name:"PostClass",
		components:{
			upLoadF,
		
		},
		data() {
			return {
				
				postMsg:{
					title:'',
					body:'',
					
					imgUrl:"",
					
				}
			}
		},
		created(){
			
		},
		methods:{		
		gettopShow(url){//子组件穿过来的处理好的图片地址
			this.postMsg.imgUrl=url
		},
			postC(){
				//调用发布文章接口
				this.$api.setNewClass(this.postMsg).then(
				   res=>{
					   
					  this.$refs.uToast.show({
					  	duration: 3000,
					  	title: '发布成功',
					  	type: 'success',
					  });
				   },
				   err=>{
					   console.log(err)
				   }
				
				)
			}
			
			
		}
	}
</script>

<style lang="scss">

.tanchuang{
	width: 50vw;
	margin-left: 300rpx;
}

</style>
